package com.efuture.chaptersix

/* @Description: Kotlin语言抽象类学习
 * @Auther: zhaoshanshan
 * @Date: 2022/03/07/7:32 下午
 */

abstract class BaseActivity{
    fun onCrate(){
        setContentView(getLayoutId())
        initView()
        initData()
    }
    private fun setContentView( id:Int){
        println("加载xml布局")
    }
    abstract fun getLayoutId(): Int
    abstract fun initView()
    abstract fun initData()

}

class MainActivity:BaseActivity(){

    override fun getLayoutId(): Int {
        println("调用getLayoutId")
        return 123
    }

    override fun initView() {
        println("调用initView")
    }

    override fun initData() {
        println("调用initData")

    }

    fun show(){
        super.onCrate()
    }

}

fun main() {
    val act = MainActivity()
    act.show()
}
    